package com.fristvue.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.fristvue.dao.ShopCartDao;
import com.fristvue.po.ShopCart;
import com.fristvue.po.Util.Page;
import com.fristvue.po.Util.ShopUtil;
import com.fristvue.service.ShopCartService;

@Service
@Transactional
public class ShopCartServiceImpl implements ShopCartService {
	@Autowired
	private ShopCartDao shopCartDao;
	/**
	 * 购物车分页查询
	 */
	@Override
	public Page<ShopCart> findShopList(Integer num, Integer size, ShopUtil shopUtil) {
		// TODO Auto-generated method stub
		Page<ShopCart> page = new Page<ShopCart>();
		page.setList(this.shopCartDao.findShopList(num, size, shopUtil));
		page.setNum(this.shopCartDao.countShop(shopUtil));
		return page;
	}
	
	@Override
	public boolean ShopCartAdd(ShopCart shopCart) {
		// TODO Auto-generated method stub
		return this.shopCartDao.ShopCartAdd(shopCart);
	}

	@Override
	public boolean DeleteShopCart(Integer shopCartId) {
		// TODO Auto-generated method stub
		return this.shopCartDao.DeleteShopCart(shopCartId);
	}

	@Override
	public ShopCart shopCartById(Integer id) {
		// TODO Auto-generated method stub
		return this.shopCartDao.shopCartById(id);
	}

	@Override
	public boolean updatShopCartById(ShopCart shopCart) {
		// TODO Auto-generated method stub
		return this.shopCartDao.updatShopCartById(shopCart);
	}

}
